package com.game.utils;

import com.game.config.Config;

/**
* @author oven:
* @version 创建时间：2012-11-6 下午2:26:00
* 
*/
public class ChangeUnitUtil {
	
	//把真实的值转换为转换比例的值
	public static float changeToScaleValueWidth(float width){
		return (Config.FULL_SCREEN?width*PhoneInfo.scaleX:width*PhoneInfo.scaleLonely);
	}
	
	public static float changeToScaleValueHeight(float height){
		return (Config.FULL_SCREEN?height*PhoneInfo.scaleY:height*PhoneInfo.scaleLonely);
	}
		
	//把已转换比例的值转换为真实的值
	public static float changeToRealValueWidth(float width){
		return (Config.FULL_SCREEN?width/PhoneInfo.scaleX:width/PhoneInfo.scaleLonely);
	}
	
	public static float changeToRealValueHeight(float height){
		return (Config.FULL_SCREEN?height/PhoneInfo.scaleY:height/PhoneInfo.scaleLonely);
	}
	
	
	
	//把已转换比例的值转换为真实的值
	public static float changeToRealValueX(float x){
		return (Config.FULL_SCREEN?x/PhoneInfo.scaleX:x/PhoneInfo.scaleLonely-PhoneInfo.startScreenX);
	}
	
	public static float changeToRealValueY(float y){
		return (Config.FULL_SCREEN?y/PhoneInfo.scaleY:y/PhoneInfo.scaleLonely-PhoneInfo.startScreenY);
	}
	
	//把已转换比例的值转换为真实的值
	public static float changeToScaleValueX(float x){
		return (Config.FULL_SCREEN?x*PhoneInfo.scaleX:x*PhoneInfo.scaleLonely+PhoneInfo.startScreenX);
	}
	
	public static float changeToScaleValueY(float y){
		return (Config.FULL_SCREEN?y*PhoneInfo.scaleY:y*PhoneInfo.scaleLonely+PhoneInfo.startScreenY);
	}
}

